#include "hotel.h"
#include"tools.h"
#include<iostream>
#include<stdio.h>
int day=0;
using namespace std;
Hotel::Hotel(void)
{
	//读取酒店的配置文件初始化酒店的房间
    uint8_t discount=0;
    cout<<"是否需要重新配置酒店(y/n)"<<endl;
    char c;
    cin>>c;
    if(c=='y')
    {
        cout<<"请输入酒店的层数";
        cin>>floor;
        cout<<"请输入每层的房间数";
        cin>>room_cnt;
        cout<<"请输入折扣";
        cin>>discount;
        set_config(floor,room_cnt,discount);
    }
    else
    {
        get_config(floor,room_cnt,discount);
	//	printf("%d %d %d\n",floor,room_cnt,discount);
    }
	const int cnt=room_cnt;
	//初始化酒店房间
    rooms=new Room*[floor];
//	rooms[0] = new Room[cnt];
    for(int i=0;i<floor;i++)
    {
		rooms[i]=new Room[cnt];
        for(int j=0;j<room_cnt;j++)
        {
            uint16_t room_id=(i+1)*100+(j+1);
            if(i<2)
            {
                RoomType type=Type1;
                float price =100;
               rooms[i][j].set_room(Type1,price,room_id,discount,day);
			   printf("%d\n",rooms[i][j].get_id());
            }
            else if(i<4)
            {
                RoomType type=Type2;
                float price =200;
                rooms[i][j].set_room(type,price,room_id,discount,day);
            }
            else if(i<6)
            {
                RoomType type=Type3;
                float price =300;
                rooms[i][j].set_room(type,price,room_id,discount,day);
            }
            else
            {
                RoomType type=Type4;
                float price =400;
                rooms[i][j].set_room(type,price,room_id,discount,day);
            }
            
        }
    }
}
Hotel::~Hotel(void)
{
    delete[] rooms;
}
//获取楼层
uint8_t Hotel::get_floor(void)
{
    return floor;
}
//获取每层楼的房间数
uint8_t Hotel::get_room_cnt(void)
{
    return room_cnt;
}
